<?php

namespace app\common\model;

use think\Model;


class Entry extends Model
{

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'create_time';


    public function insert($data)
    {
        if(isset($data['pic'])) {
            $data['pic'] = implode(',', $data['pic']);
        }
        $result = $this->validate(true)->allowField(true)->save($data);
        if(false === $result){
            return ['code' => 0, 'msg' => $this->getError()];
        }else{
            return ['code' => 1, 'msg' => '提交成功'];
        }
    }
}
